package study.couse04;

import java.util.concurrent.locks.LockSupport;

public class UseLockSupport {
    static volatile  Integer res = null;
    public static void main(String[] args) throws InterruptedException {
        new Thread(new CountDownLatchSub(Thread.currentThread())).start();
        LockSupport.park();
        System.out.println("子线程结果:"+res);
    }
    static class CountDownLatchSub implements Runnable {

        Thread main;
        public CountDownLatchSub(Thread main) {
            this.main = main;
        }

        @Override
        public void run() {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            res = 1;
            LockSupport.unpark(main);
        }
    }
}
